package com.lw.question13;

import java.util.Scanner;

/**
 * @author LW
 * @2020/9/18 11:14
 */
public class task2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int m =scanner.nextInt();
        int n=scanner.nextInt();
        int mm=m;
        int nn=n;
        int temp = 1;
        int yshu = 1;
        int bshu = m * n;
        if (n < m) {
            temp = n;
            n = m;
            m = temp;
        }
        while (m != 0) {
            temp = n % m;
            n = m;
            m = temp;
        }
        yshu = n;
        bshu /= n;
        System.out.println(mm + "和" + nn + "的最大公约数为" + yshu);
        System.out.println(mm + "和" + nn + "的最小公倍数为" + bshu);
    }
}
